import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";
import path from "path";
import AutoImport from "unplugin-auto-import/vite";
import Components from "unplugin-vue-components/vite";
import { ElementPlusResolver } from "unplugin-vue-components/resolvers";
import viteCompression from "vite-plugin-compression";
// import electron from "vite-plugin-electron";
// https://vitejs.dev/config/
export default defineConfig({
  base: "./",
  // publicPath: "/",
  // outputDir: "dist",
  // assetsDir: "static",
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
      "@i": path.resolve(__dirname, "./src/assets"),
    },
  },
  // server: {
  //     // 请求代理
  //     proxy: {
  //         '/admin': {
  //             // 这里的地址是后端数据接口的地址
  //             target: 'http://localhost:8877/',
  //             //rewrite: (path) => path.replace(/^\/admin/, ''),
  //             // 允许跨域
  //             changeOrigin: true

  //         }
  //     }
  // },
  plugins: [
    vue(),
    AutoImport({
      resolvers: [ElementPlusResolver()],
    }),
    Components({
      resolvers: [ElementPlusResolver()],
    }),
    viteCompression(),
    // electron({
    //   entry: "electron/main.js",
    // }),
  ],
});
